//
// Created by linyongzhi on 2023/12/11.
//

#ifndef PC_SDK_DEMO_CPHOPUSDECODER_H
#define PC_SDK_DEMO_CPHOPUSDECODER_H

#include <cstdio>
#include <queue>
#include <mutex>
#include "opus.h"
#include "CPHBuffer.h"

class CPHBufferQueue;
class CPHOpusDecoder {
public:
    int Init();
    int DeInit();
    int Decode();

    void SetPCMQueue(CPHBufferQueue *pcmQueue);
private:

    static void decodeTaskEntry(CPHOpusDecoder *opusDecoder);
private:
    OpusDecoder *decoder = NULL;
    FILE *fpInput = NULL;

    CPHBufferQueue *pcmBufferQueue {nullptr};
    std::thread *decodeThread {nullptr};
};


#endif //PC_SDK_DEMO_CPHOPUSDECODER_H
